package com.letoken.platform.repo.app.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.letoken.platform.repo.app.po.AppUserTeam;
import com.letoken.platform.repo.app.po.AppUserTeamPath;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * Le账户-团队统计信息(KOL) Mapper 接口
 * </p>
 *
 * @author 作者
 * @since 2022-12-15
 */
public interface AppUserTeamPathMapper extends BaseMapper<AppUserTeamPath> {


    /**
     * 拿到所有自己的下级
     * @param userId
     * @return
     */
    List<Integer> queryTeamPathUserIdByInviteId(@Param("userId") Integer userId);

    List<AppUserTeamPath> listByInviteId(@Param("userId") Integer userId);

    List<AppUserTeamPath> getPathList (@Param("userId")Integer userId);

    String queryLeaderId(@Param("userId")String userId);

    @Select("select invite_path from app_user_team_path where user_id = #{userId} and invite_path is not null and invite_path != '' and invite_path != '0' limit 1 ")
    String checkoutAppUserTeam(@Param("userId") Integer userId);

    List<AppUserTeam> getMAXTeamValueSizePlus(@Param("inviterId") Integer inviterId);
}
